max-pycor

 

Max-pxcor and max-pycor return patches' maximum x-coordinate and maximum y-coordinate, respectively. The maximum x and y coordinates of patches also determine the size of the model, and must always be greater than or equal to zero. Max-pxcor and max-pycor cannot be changed within the code; the size of the world can only be changed by editing the view.

Similarly, min-pxcor and min-pycor return patches' minimum x-coordinate and minimum y-coordinate respectively. The minimum x and y coordinates must be less than or equal to zero. For example, ask patches with [pxcor = min-pxcor or pycor = min-pycor] [ set pcolor blue ] would set the patches along the bottom and left side of the model to blue.

Note: like how turtles use color and patches use pcolor, it is important to distinguish between xcor and ycor, which are only used by turtles, and pxcor and pycor, which are only used by patches.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the max-pycor primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Published NetLogo models that use the max-pycor primitive:
 
 
Similar primitives:
min-pxcor

Find patches' smallest x-coordinate.

Read more
min-pycor

Find patches' smallest y-coordinate.

Read more
move-to

allows a turtle to set its x and y coordinates to be the same as another turtle or patch

Read more
setxy

set the position of a turtle (in terms of X and Y coordinates)

Read more
 
Learn another primitive